<extend name="Public/layout"/>
<block name="head">
    <link rel="stylesheet" href="__PUBLIC__css/jump-to-platform.css">
    <script src="__PUBLIC__assets/better-scroll/bscroll.min.js"></script>
    <style type="text/css">
        .footer {
            display: none;
        }
    </style>
</block>
<block name="main">
    <div class="main">
        <div class="header">
            <div class="logo-wrapper">
                <img src="{$platform.pic}" alt="">
            </div>
        </div>
        <div class="gif-wrapper">
            <img src="__PUBLIC__images/loading.gif" alt="">
        </div>
        <h4 class="jump-title">正在为您跳转平台</h4>


 <if condition="($platform.id eq 5) or ($platform.id eq 7) or ($platform.id eq 17)or ($platform.id eq 19)"> 

        <!--第一种情况-->
        <div class="content">
            <div class="info-wrapper">
                <p>为您生成的{$platform.name}账户为</p>
                <p class="phone-number">{:hidtel($user_info[user_phone])}</p>
            </div>
            <div class="text-wrapper">
                <p>注册平台时，请不要填写邀请码</p>
                <p>如不在跳转后页面注册，则不享受返利</p>
                <p>需投资平台投资方案的标的才会有返利哦~</p>
            </div>
            <div class="btn-wrapper">
                <a href="/Home/Financial/event/id/{$platform.id}" class="btn">暂不跳转，去查看平台详情</a>
            </div>
        </div>
 
 <else/>
        <!--第二种情况-->
        <div class="content">
            <div class="info-wrapper">
                <p>为您生成的{$platform.name}账户为</p>
                <p class="phone-number">{:hidtel($user_info[user_phone])}</p>
            </div>
            <div class="text-wrapper">
                <p><span class="icon-mark"></span>平台初始登录密码将以短信的形式发送给您</p>
            </div>
            <div class="btn-wrapper">
                <a href="/Home/Financial/event/id/{$platform.id}" class="btn">暂不跳转，去查看平台详情</a>
            </div>
        </div>

</if>




        <!--第三种情况-->
        <!--<div class="content">-->
            <!--<div class="text-wrapper border-bottom">-->
                <!--<p>您已通过其他渠道注册了立马理财</p>-->
                <!--<p>继续通过8号金融街跳转</p>-->
                <!--<p>将不会享受返利</p>-->
            <!--</div>-->
            <!--<div class="btn-wrapper">-->
                <!--<a href="#" class="btn">暂不跳转，去查看平台详情</a>-->
            <!--</div>-->
        <!--</div>-->
    </div>
    <form id="formdata" action="" method="post">
        <input type="hidden" id="fdata" name='data' value=''>
    </form>
</block>
<block name="js">
    <script src="__PUBLIC__js/platform-details.js"></script>
    <script>
        $(function(){
                setTimeout(function(){bind_plat()},2000)
        })
              // 已在别的渠道注册的用户
        var h2 = ''
        h2 += '<div class="platform-layer not-a-menber"><h5>正在为您跳转平台</h5>'
        h2 += '<div class="plat-logo"><img src="{$platform.pic}" width="110px" height="28px"></div>'
        h2 += '<div class="text-wrapper">'
        h2 += '<p class="text">您已通过其他渠道注册了{$platform.name}，继续通过8号金融街跳转，将不会享受返利</p></div>'
        h2 += '<div class="btn-wrapper"><a href="javascript:" onclick="layer.closeAll()">返回8号金融街</a></div>'
        h2 += '</div>'


        function notjointPlatform() {
            layer.closeAll()
            layer.open({
                content: h2,
                type: 1,
                shadeClose: false
            })
        }

        function bind_plat() {

            var id = "{$_GET['plat_id']}";
            var userid = "{$_GET['userid']}";
            var token = "{$_GET['token']}";

            if(userid || token){
                var postdata = {id:id,userid:userid,token:token}
            }else{
                var postdata = {id:id}

            }
            if (id == 2) {

                //绑定用户
                $.post('{:U("Platform/wy_bind_user")}',postdata, function (res) {
                    if (res.err == 0) {

                        if (res.msg == 1) {
                            notjointPlatform();

                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }
                    }
                })

            } else if (id == 8) {

                $.post('{:U("Platform/gs_bind_user")}',postdata, function (res) {
                    if (res.err == 0) {
                        if (res.msg == 1) {
                           notjointPlatform();
                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }

                    }

                })
            } else if (id == 11) {
                $.post('{:U("Platform/zr_bind_user")}',postdata, function (res) {
                    if (res.err == 0) {

                        if (res.msg == 1) {
                           notjointPlatform();
                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }

                    }

                })
            } else if (id == 12) {
                $.post('{:U("Platform/wj_bind_user")}',postdata, function (res) {
                    //console.log(res);return;
                    if (res.err == 0) {

                        if (res.msg == 1) {
                           notjointPlatform();
                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }

                    }

                })
            } else if (id == 1) {
                $.post('{:U("Platform/ph_bind_user")}',postdata, function (res) {
                    console.log(res);
                    if (res.err == 0) {

                        if (res.msg == 1) {
                            notjointPlatform();
                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }

                    }

                })
            } else if (id == 18) {
                $.post('{:U("Platform/hl_bind_user")}',postdata, function (res) {
                    //console.log(res);return;
                    if (res.err == 0) {

                        if (res.msg == 1) { 
                            notjointPlatform();
                        } else {
							var path = res.url;
							location.href=path
                        }

                    }

                })
            }else if (id == 21) {

                $.post('{:U("Platform/ljs_bind_user")}',postdata, function (res) {  
                    if (res.err == 0) {
                        if (res.msg == 1) {
                           notjointPlatform();
                        } else {
                            var path = res.url;
                            $('#fdata').val(res.data);
                            $('#formdata').attr('action', path);
                            $('#formdata').submit();
                        }

                    }

                })
            } else if (id==17) {
                location.href ="https://www.touna.cn/api/redirectApi.do?method=normal&target_url=https://m.touna.cn/activity/signUpAct_wap/cps-wap.html&utm_source=8hjr&utm_medium=4"
            }  else if (id==19) {
                location.href ="https://www.yesvion.com/apppage/LandingPage/index?from=8hjrj"
            }  else if (id==20) {
                location.href ="https://pccb.com/wap/sem/soeRegister?registerSource=8hjrj002"
            }  else if (id==22) {
                location.href ="https://m.rjs.com/register.html?requestFrom=8hao"
            }else if (id==23) {
                location.href ="https://tg.tuandai.com/phone/reg0520_new/index.aspx?tdfrom=SEOLCe28e71000 "
            }else if (id==24) {
                location.href ="https://www.babymoney.cn/m/reward/p2p/reg?channel=dywjrj"
            }else if (id==25) {
                location.href ="https://lc.m.xintongdai.com/generalizeRegister/toGeneralizeRegister?channelId=338"
            }else {
                var plat_url = "{$platform.land_page}";
                location.href = plat_url
            }

        }
    </script>
</block>